<template>
	<scroll-view @scrolltolower="scrolltolower" :refresher-enabled="true" :scroll-y="true" class="list-con">
		<uni-list class="list">
			<uni-list-item :clickable="true" @click="goto(item)" v-for="(item,index) in value" :key="index"
				:title="makeTitle(item)" :rightText="makeTime(item.createTime)">
			</uni-list-item>
		</uni-list>
	</scroll-view>
</template>

<script>
	import adcode from "@/common/util/adCode.js"
	export default {
		props: ["value"],
		methods: {
			/**
			 * 翻页
			 */
			scrolltolower() {
				this.$emit("scrolltolower")
			},
			/**
			 * 处理时间数据
			 * @param {Object} time
			 */
			makeTime(time) {
				return time.split(" ")[0]
			},
			/**
			 * 处理标题
			 * @param {Object} record
			 */
			makeTitle(record) {
				const qybc = adcode[record.qybm]
				return "【" + qybc + "】" + " " + record.title
			},
			/**
			 * 页面跳转
			 * @param {Object} item
			 */
			goto(item) {
				uni.navigateTo({
					url: 'detail?id=' + item.id
				})
			}
		}
	}
</script>

<style lang="less">
	.list-con {
		height: 90vh;
		justify-content: space-between;
		background: #ffffff;
		align-self: stretch;
	}
</style>
